/**
 * $Revision: 1.0 $
 * $Author: Eric Yang $
 * $Date: Nov 22, 2009 11:31:52 PM $
 *
 * Author: Eric Yang
 * Date  : Nov 22, 2009 11:31:52 PM
 *
 */
package com.gooex.web.action.gbuy.product;

import java.util.List;

import com.gooex.domain.base.Product;
import com.gooex.domain.base.Property;
import com.gooex.service.base.IProductManager;
import com.gooex.web.action.BaseProtectedAction;


/**
 * @author Eric Yang
 * @version 1.0
 */
public class ProductPropertyAction extends BaseProtectedAction {

	private IProductManager productManager;

	private Product product;

	private String id;

	private List<Property> properties;

	public String edit() throws Exception {
		product = productManager.loadProduct(id);
		properties = product.getProperties();
		return SUCCESS;
	}

	public String save() throws Exception {
		product = productManager.loadProduct(id);
		productManager.updateProperty(product, properties);
		return SUCCESS;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public List<Property> getProperties() {
		return properties;
	}

	public void setProperties(List<Property> properties) {
		this.properties = properties;
	}

	public void setProductManager(IProductManager productManager) {
		this.productManager = productManager;
	}
}
